<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <meta name="format-detection" content="telephone=no" />
    <title>销售入账页面</title>
    <link rel="stylesheet" href="../../css/reset.css">
    <style>
        body {
            width: 100%;
            height: 100%;
            font-size: 0.28rem;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            font-family: PingFang SC;
            color: #333333;
            background-color: #f8f8f8;
        }

        .fixedBox {
            width: 100%;
            height: 0.7rem;
            position: sticky;
            top: 0;
            left: 0;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: space-around;
            background-color: #ffffff;
            box-sizing: border-box;
        }

        .fixedBox p {
            width: 1rem;
            height: 0.7rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            font-size: 0.3rem;
            justify-content: space-around;
            border-bottom: 0.05rem solid #ffffff;
            color: #999999;
            box-sizing: border-box;
        }

        .fixedBox .choosep {
            border-bottom-color: #ffd203;
            color: #262626;
        }

        .rechordList {
            width: 100%;
            height: auto;
            padding-top: 0.2rem;
        }

        #ulListRecord {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }

        #ulListRecord li {
            width: 6.9rem;
            height: auto;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 0.24rem 0.27rem;
            background-color: #fff;
            border-radius: 0.1rem;
            box-sizing: border-box;
            margin-bottom: 0.19rem;
        }

        #ulListRecord li p {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            justify-content: space-between;
            align-items: center;
        }

        li p:first-of-type {
            color: #262626;
        }

        li p:first-of-type span:last-child {
            font-size: 0.24rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
        }

        li p:last-of-type {
            color: #999999;
            font-size: 0.24rem;
            margin-top: 0.13rem;
        }

        li p:last-of-type span:last-child {
            font-size: 0.26rem;
            color: rgba(38, 38, 38, 1);
        }

        #listState {
            width: 100%;
            margin: 0.3rem 0;
            text-align: center;
            font-size: 0.24rem;
        }
    </style>
</head>

<body>
    <div class="fixedBox">
        <p class="choosep" data-type="outCoin">
            提现
        </p>
        <p data-type="inputCoin">
            入账
        </p>
    </div>
    <div class="rechordList">
        <ul id="ulListRecord">
            <!-- <li>
                <p>
                    <span>
                        BTC提成账户
                    </span>
                    <span> -->
            <!-- 审核中 color:#ED5252 成功#17BE8D 失败 #B3B3B3-->
            <!-- 审核中 -->
            <!-- <img src="../../image/shibaiyuanyinx.png" alt="" style="width: 0.28rem;margin-left: 0.1rem;">
                    </span>
                </p>
                <p>
                    <span style="color: #999999;">
                        2020-05-05 12:15:56
                    </span>
                    <span>
                        512.30 CNY
                    </span>
                </p>
                <p style="margin-top:0.06rem;justify-content: flex-start;">
                    <span>任务ID：#125464113185412121 </span>
                    <span class="copyId" data-copyId=""><img src="../../image/copyxsdf.png"
                            style="width: 0.74rem;margin-left: 0.1rem;"></span>
                </p>
            </li> -->
            <!-- <li>
                <p>
                    <span>
                        BTC提成账户
                    </span>
                    <span>
                    </span>
                </p>
                <p>
                    <span>
                        2020-05-05 12:15:56
                    </span>
                    <span>
                        512.30 CNY
                    </span>
                </p>
            </li> -->
        </ul>
    </div>
    <div id="listState">
        加载中
    </div>
</body>
<script src="../../script/autosize.js"></script>
<script src="../../script/jquery_three_two_one.js"></script>
<script src="../../script/fastclick.js"></script>
<script src="../../script/dotmin.js"></script>
<script src="../../script/app.js"></script>
<script>
    apiready = function () {
        var app = new APP();
        var account = app.getAccount();
        var curpage = 1;//当前页
        var totalpgae = 1;//总页数
        var chooseType = "outCoin";//选择记录的种类
        //提现记录
        function getrecord(account, page, isdown) {
            app.ajaxPro({
                url: "ipfs-withdraw/get-new-withdraw-lists",
                values: {
                    token: account.token,
                    page: page
                },
                openFlower: true
            }, function (ret) {
                if (ret.code == 200) {
                    totalpgae = ret.data.total_page;
                    var temp = doT.template($("#couponListLi").text());
                    if (isdown) {
                        $("#ulListRecord").html(temp(ret.data.lists));
                    } else {
                        $("#ulListRecord").append(temp(ret.data.lists));
                    }
                    if (curpage == 1 && ret.data.lists.length == 0) {
                        $("#listState").show().text("暂时没有数据");
                    }
                    if (curpage < totalpgae && totalpgae > 1) {
                        $("#listState").text("下拉加载更多");
                    }
                    if (curpage == totalpgae && ret.data.lists.length != 0) {
                        $("#listState").text("没有更多了");
                    }
                } else {
                    app.toast(ret.message);
                }
            })
        }
        getrecord(account, curpage, true);
        //入账记录
        function getInputrecord(account, page, isdown) {
            app.ajaxPro({
                url: "ipfs-withdraw/get-entry-record",
                values: {
                    token: account.token,
                    page: page
                },
                openFlower: true
            }, function (ret) {
                if (ret.code == 200) {
                    totalpgae = ret.data.total_page;
                    ret.data.list.map(function (item) {
                        item.num = app.sliceNum(item.num, 2);
                    })
                    var temp = doT.template($("#ListLiinput").text());
                    if (isdown) {
                        $("#ulListRecord").html(temp(ret.data.list));
                    } else {
                        $("#ulListRecord").append(temp(ret.data.list));
                    }
                } else {
                    app.toast(ret.message)
                }
            })
        }
        $(".fixedBox p").click(function () {
            $(this).addClass("choosep").siblings().removeClass("choosep");
            chooseType = $(this).attr("data-type");
            curpage = 1; totalpgae = 1;
            $("#ulListRecord").empty();
            if (chooseType == "outCoin") {
                getrecord(account, curpage, true);
            } else {
                getInputrecord(account, curpage, true);
            }
        })
        $("#ulListRecord").on("click", "li .faileClass", function () {
            var typeAccount = $(this).attr("data-status");
            console.log("-----------0" + typeAccount)
            if (typeAccount == "4") {
                var param = {
                    dtype: "dialog91"
                };
                app.dialog(param);
            } else {
                var param = {
                    dtype: "dialog85",
                    data: {
                        text: $(this).attr("data-resone")
                    }
                };
                app.dialog(param);
            }
        })
        $("#ulListRecord").on("click", "li .copyId", function () {
            var idNum = $(this).attr("data-copyId");
            if (idNum && app.clipboard) {
                app.clipboard.set({ value: idNum }, function (ret, err) {
                    if (ret.status) {
                        app.toast("复制成功");
                    } else {
                        app.toast("复制失败");
                    }
                });
            }
        })
        //下拉刷新
        app.downRefresh(function () {
            curpage = 1; totalpgae = 1;
            $("#ulListRecord").empty();
            if (chooseType == "outCoin") {
                getrecord(account, curpage, false);
            } else {
                getInputrecord(account, curpage, false);
            }
        })
        //加载更多
        app.toBottom(function () {
            if (curpage < totalpgae) {
                curpage++;
                if (chooseType == "outCoin") {
                    getrecord(account, curpage, false);
                } else {
                    getInputrecord(account, curpage, false);
                }
            }
        })
        app.headerMap();
    }
</script>
<!-- 提现 -->
<script type="text/html" id="couponListLi">
    {{~it:it:index}}
    <li>
        <p>
            <span>
                {{=it.withdraw_name.split("_")[0]}}提成账户
            </span>
            {{?it.state==1}}
                <span style="color:#ED5252">
                    审核中
                </span>
            {{??it.state==2}}
                <span style="color:#17BE8D">
                    成功
                </span>
            {{??it.state==3}}
                <span style="color:#B3B3B3" class="faileClass" data-status={{=it.state}} data-resone={{=it.remark}} data-nameType={{=it.withdraw_name}}>
                    失败 <img src="../../image/shibaiyuanyinx.png" alt="" style="width: 0.28rem;margin-left: 0.1rem;">
                </span>
            {{??}}
                <span style="color:#FEA430" class="faileClass" data-status={{=it.state}} data-resone={{=it.remark}} data-nameType={{=it.withdraw_name}}>
                    税筹平台处理中 <img src="../../image/shibaiyuanyinx.png" alt="" style="width: 0.28rem;margin-left: 0.1rem;">
                </span>
            {{?}}
        </p>
        <p>
            <span style="color:#999999;">
                {{=it.create_time}}
            </span>
            <span>
               {{=it.withdraw_money}}CNY
            </span>
        </p>
        {{?it.state==4 || (it.state==2 && it.account_type==1)}}
            <p style="margin-top:0.06rem;justify-content: flex-start;">
                <span style="color:#595959;">任务ID：#{{=it.zlb_order_num}} </span>
                <span class="copyId" data-copyId="{{=it.zlb_order_num}}"><img src="../../image/copyxsdf.png" style="width: 0.74rem;margin-left: 0.1rem;"></span>
            </p>
        {{?}}
    </li>
    {{~}}
</script>
<!-- 入账 -->
<script type="text/html" id="ListLiinput">
    {{~it:it:index}}
    <li>
        <p>
            <span>
                {{=it.currency_name.split("_")[0]}}提成账户
            </span>
            <span>
            </span>
        </p>
        <p>
            <span>
                {{=it.add_time}}
            </span>
            <span>
                {{=it.type==2?"-":"+"}} {{=it.num}}CNY
            </span>
        </p>
    </li>
    {{~}}
</script>

</html>